package com.airconditioning.service.impl;

import com.airconditioning.entity.Enum;
import com.airconditioning.mapper.EnumMapper;
import com.airconditioning.service.IEnumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.Long;
import java.util.List;

@Service
public class EnumServiceImpl implements IEnumService{

    @Autowired
    private EnumMapper enumMapper;

    @Override
    public boolean updateByPrimaryKeySelective(Enum enum){
           Integer result = enumMapper.updateByPrimaryKeySelective(enum);
           if(result == 1){
               return true;
           }else{
               return false;
           }

    }

    @Override
    public Long insertSelective(Enum enum){
        Long result = enumMapper.insertSelective(enum);
            return result;
    }

    @Override
    public Enum selectByPrimaryKey(Long id){
        Enum enum = enumMapper.selectByPrimaryKey(id);
            return enum;
    }

    @Override
    public Integer selectCountByExample(Enum enum){
        return enumMapper.selectCountByExample(enum);
    }

    @Override
    public List<Enum> selectListByExample(Enum enum){
        return enumMapper.selectListByExample(enum);
    }


    @Override
    public Enum selectBeanByExample(Enum enum){
        List<Enum> enumList = enumMapper.selectListByExample(enum);
        if (enumList == null || enumList.size() < 1) {
            return null;
        }
        return enumList.get(0);
    }

}
